from selenium import webdriver
from selenium.webdriver.common.by import By

from spider_h5.seleinum_bankend.pages.sec_level.applet_page import AppletPage
from spider_h5.seleinum_bankend.pages.sec_level.setting_page import SettingPage

"""
Description:引导页
Note: 关于测试工作比较常用的是小程序页和设置页，后续需要什么页再具体添加
"""


class IndexPage(object):

    def __init__(self, client):
        self.client = client
        self.browser: webdriver = client.browser

    def turn_applet_page(self):
        """
        切到小程序页
        """
        # 切换左侧Tab页到小程序页
        self.browser.find_element(By.XPATH, '/html/body/div/div[1]/div/ul/li[4]/a').click()
        return AppletPage(self.client)

    def turn_setting_page(self):
        """
         切到设置页
        """
        self.browser.find_element(By.XPATH, '/html/body/div/div[1]/ul[1]/li[10]/a').click()
        return SettingPage(self.client)
